import { queryRule, removeRule, addRule, updateRule, queryTestRule } from '@/services/api';
import { getInfo, getSize } from '../../../services/astock_service';
import { notification } from 'antd';

export default {
  namespace: 'astock',

  state: {

  },

  effects: {
// stock
    *GetInfo({ payload, callback }, { call, put }) {
      const response = yield call(getInfo, payload);
      if (typeof response === 'undefined') {
        return;
      }
      if (typeof response !== 'undefined' && response.code === 1) {
        if (callback) callback(response);
      } else {
        notification.error({
          message: typeof response.message !== 'undefined' ? response.message : '请求错误',
        });
      }
    },
    *GetSize({ payload, callback }, { call, put }) {
      const response = yield call(getSize, payload);
      if (typeof response === 'undefined') {
        return;
      }
      if (typeof response !== 'undefined' && response.code === 1) {
        if (callback) callback(response);
      } else {
        notification.error({
          message: typeof response.message !== 'undefined' ? response.message : '请求错误',
        });
      }
    },

  },

  reducers: {
  },
};
